
LoginController.$inject = ['merchantService','$scope','$location'];
function LoginController(merchantService,$scope,$location) {
  var $ = require('jquery');
  var vm = $scope.vm={};
  vm.merchangt = {};
  vm.err = '';
  $('#nav').css("display","none");  
        vm.submit = function () {
            console.log('submit')
            
            $('#basic_form').submit();
        };

   vm.login = function(){
       merchantService.merchantLogin(vm.merchant,function(error,result){
           console.log("result:....");
           console.log(result);
           console.log(result.status1);
       if(result.status1!=1){
           sessionStorage.result = JSON.stringify(result);
          $location.path("/updateInfo/"+result.m._id);
       }else{
       if(result.length == 0){
            vm.err = "用户名或密码错误！！";
            $location.path("/login");
        }else{
            sessionStorage.merchant = JSON.stringify(result);
            console.log(sessionStorage.merchant);
            $location.path("/foodlist");
        }
       }
       });

   } 

        



}

module.exports = LoginController;